/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package resources.reports;

import net.sf.jasperreports.engine.JRExporter;
import net.sf.jasperreports.engine.export.JRPdfExporter;
import net.sf.jasperreports.engine.export.JRXlsExporter;
import net.sf.jasperreports.engine.export.ooxml.JRDocxExporter;
/**
 *
 * @author isaias
 */
public enum ReportFormats {
    PDF(".pdf", "application/pdf"), DOCX(".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"),
    XLSX(".xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");

    private ReportFormats(String extension, String contentType) {
        this.extension = extension;
        this.contentType = contentType;
    }

    private String extension;
    private String contentType;

    public String getContentType() {
        return contentType;
    }

    public String getExtension() {
        return extension;
    }

    public static JRExporter getCorrectJRExporter(ReportFormats reportFormats) {
        if (reportFormats == DOCX) {
            return new JRDocxExporter();
        } else if (reportFormats == XLSX) {
            return new JRXlsExporter();
        } else {
            return new JRPdfExporter();
        }
    }
}
